package com.tang.server;

import com.tang.codec.ObjDecoder;
import com.tang.codec.ObjEncoder;
import com.tang.domain.FileTransferProtocol;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

/**
 * 
 * 
 * @author fulin.tang
 * @version V3.0
 * @since 2022/5/17 14:18
 */
public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ch.pipeline().addLast(new ObjDecoder(FileTransferProtocol.class));
        ch.pipeline().addLast(new ObjEncoder(FileTransferProtocol.class));
        ch.pipeline().addLast(new MyServerHandler());
    }

}
